<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断20岁处在那个年龄段</title>
</head>
<body>
    <script>
        function a (a1){
            if(a1>=0&&a1<=6){
                alert(+a1+"岁处于童年时期");
            }else if(a1>=7&&a1<=17){
                alert(+a1+"岁处于少年时期");
            }if(a1>=18&&a1<=40){
                alert(+a1+"岁处于青年时期");
            }if(a1>=41&&a1<=65){
                alert(+a1+"岁处于中年时期");
            }else{
                alert(+a1+"岁处于老年时期");
            }
        }
        a(20);
    </script>
</body>
</html>